/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.servinf.ani.sincronizador.entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author mortiz
 */
@Entity
@Table(catalog = "ani_admin", schema = "public")
@NamedQueries({
    @NamedQuery(name = "Municipio.findAll", query = "SELECT m FROM Municipio m")})
public class Municipio implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "codigo_mcpo")
    private Integer codigoMcpo;
    @Basic(optional = false)
    private String nombre;
    private String area;
    @OneToMany(mappedBy = "ciudadOrigen")
    private List<TramoVia> tramoViaList;
    @OneToMany(mappedBy = "ciudadDestino")
    private List<TramoVia> tramoViaList1;
    @JoinColumn(name = "codigo_dpto", referencedColumnName = "codigo_dpto")
    @ManyToOne(optional = false)
    private Departamento codigoDpto;

    public Municipio() {
    }

    public Municipio(Integer codigoMcpo) {
        this.codigoMcpo = codigoMcpo;
    }

    public Municipio(Integer codigoMcpo, String nombre) {
        this.codigoMcpo = codigoMcpo;
        this.nombre = nombre;
    }

    public Integer getCodigoMcpo() {
        return codigoMcpo;
    }

    public void setCodigoMcpo(Integer codigoMcpo) {
        this.codigoMcpo = codigoMcpo;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public String getArea() {
        return area;
    }

    public void setArea(String area) {
        this.area = area;
    }

    public List<TramoVia> getTramoViaList() {
        return tramoViaList;
    }

    public void setTramoViaList(List<TramoVia> tramoViaList) {
        this.tramoViaList = tramoViaList;
    }

    public List<TramoVia> getTramoViaList1() {
        return tramoViaList1;
    }

    public void setTramoViaList1(List<TramoVia> tramoViaList1) {
        this.tramoViaList1 = tramoViaList1;
    }

    public Departamento getCodigoDpto() {
        return codigoDpto;
    }

    public void setCodigoDpto(Departamento codigoDpto) {
        this.codigoDpto = codigoDpto;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (codigoMcpo != null ? codigoMcpo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Municipio)) {
            return false;
        }
        Municipio other = (Municipio) object;
        if ((this.codigoMcpo == null && other.codigoMcpo != null) || (this.codigoMcpo != null && !this.codigoMcpo.equals(other.codigoMcpo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.servinf.ani.sincronizador.entities.Municipio[ codigoMcpo=" + codigoMcpo + " ]";
    }
    
}
